////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
//		File Name		:		CPowerUp.h
//
//		Author			:		Vindicated Games
//
//		Purpose			:		A header for all functions and members of the PowerUp class
//
//		Dates			:		Written( March 1, 2011 ) by Vindicated Games		LastUpdate( March 1, 2011  ) by Vindicated Games 
//	
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
#include "CPowerUp.h"
#include "../SGD Wrappers/CSGD_TextureManager.h"
#include "../SGD Wrappers/CSGD_Direct3D.h"
#include "../Managers/VIN_ObjectManager.h"
#include "CPlayer.h"


CPowerUp::CPowerUp()
{
	SetPowerUpType(POW_NULL);
	SetType(OBJ_POWERUP);
}

CPowerUp::~CPowerUp()
{

}

void CPowerUp::Render()
{
	CSGD_TextureManager* pTM = CSGD_TextureManager::GetInstance();
	pTM->Draw( GetImageID(), (int)GetPosX(), (int)GetPosY(), 1.0f, 1.0f );

	RECT Collision;
	SetRect( &Collision, (int)GetPosX(), (int)GetPosY(), int(GetPosX() + GetWidth()), int(GetPosY() + GetHeight()) );
}

void CPowerUp::Update( float fElapsedTime )
{
	CBaseObject::Update(fElapsedTime);
}

RECT CPowerUp::GetRect()
{
	RECT CollisionRect;
	SetRect(&CollisionRect, (int)GetPosX(), (int)GetPosY(), (int)(GetPosX() + GetWidth()), (int)(GetPosY() + GetHeight()));
	return CollisionRect;
}

bool CPowerUp::CheckCollision( IBaseInterface* pBase )
{
	RECT TempRect;

	if(IntersectRect(&TempRect, &GetRect(), &pBase->GetRect() ) )
	{
		if( pBase->GetType() == OBJ_PLAYER )
		{	
			// If the power up touches the Player, do the following
			//CPlayer* pPBase = (CPlayer*)pBase;
		}
	}
	return false;
}